{
Pavlov Arsenij
Summator
}
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
    summer = class
        N, Sum : Integer;
    end;

    fast = class(summer)
       procedure writesum(N : Integer);
    end;


    slow = class (summer)
        procedure writesum(N : Integer);
    end;

{ fast }

procedure fast.writesum(N: Integer);
var
  sum : Integer;
begin
    Sum := Round((N * (N + 1) / 2));
    writeln(Sum);
end;

{ slow }

procedure slow.writesum(N: Integer);
var
  I, Sum : Integer;
begin
  sum := 0;
  For I := 0 to N do
      Sum := Sum + I;
  writeln(Sum:0);
end;
var
  a : Integer;
  x : fast;
  y : slow;
  q : summer;
begin
  q := summer.Create;
  x := fast.Create;
  y := slow.Create;
  read(a);
  x.writesum(a);
  y.writesum(a);
  Readln;
  Readln;
  Readln;


end.
